package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.mapper.TbManufactorMapper;
import com.lrkj.back.entity.TbManufactor;
import com.lrkj.back.service.TbManufactorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("manufactor")
public class TbManufactorServiceImpl extends ParentServiceImpl<TbManufactor> implements TbManufactorService {

    @Autowired
    private TbManufactorMapper tbManufactorMapper;

    @Override
    protected DBInterface<TbManufactor> getDao() throws DBException {
        return tbManufactorMapper;
    }

    @Override
    public List<TbManufactor> findAllManufactor(Map<String, Object> map) throws DBException {
        return tbManufactorMapper.findAllManufactorByConPage(map);
    }

    @Override
    public PageInfo<TbManufactor> findAllManufactorByConPage(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<TbManufactor> mfList = tbManufactorMapper.findAllManufactorByConPage(map);
        PageInfo<TbManufactor> page = new PageInfo<TbManufactor>(mfList);
        return page;
    }
}
